package com.example.demo.mapper;

import com.example.demo.entity.Major;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface MajorMapper extends JpaRepository<Major,String> {
    @Query(name="findMajorBySname",nativeQuery = true,value="select * from major where sname=:sname")
    List<Major> findMajorBySname(String sname);

    @Query(name="findMajorByName",nativeQuery = true,value="select * from major where mname=:mname")
    Major findMajorByName(String mname);

    @Query(name="selectNameAll",nativeQuery = true,value="select mname from major")
    List<String> selectNameAll();
}
